/*
 * StrongT - Sistema Web
 * Copyright 2011-2012
 *
 * Autor               : Vanie Torres
 * Fecha Registro      : 21/10/2012 08:32:06 AM
 * Detalle             : AuditoriaData
 */

package com.strategy.modulo.web.util;

import java.io.Serializable;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author Vanie Torres
 */
public class AppAuditor implements Serializable {

    protected String usuario;
    protected String ip;

    public AppAuditor() {

        FacesContext context = FacesContext.getCurrentInstance();
        ExternalContext ext = context.getExternalContext();
        HttpServletRequest httpRequest = (HttpServletRequest)ext.getRequest();
        usuario = (httpRequest.getRemoteUser() != null) ? httpRequest.getRemoteUser() : "admin";
        ip = httpRequest.getRemoteAddr();
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getUsuario() {
        return usuario;
    }

    public void setUsuario(String usuario) {
        this.usuario = usuario;
    }

}


